﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QLThuVien
{
    class The
    {
        string madg, mathe;
        DateTime ngaycap, ngayhethan;
        public The() { }
        public The(string mathe, string madg, DateTime ngaycap, DateTime ngayhethan)
        {
            this.madg = madg;
            this.mathe = mathe;
            this.ngaycap = ngaycap;
            this.ngayhethan = ngayhethan;
        }

        public void set_mathe(string mathe)
        {
            this.mathe = mathe;
        }

        public void set_madg(string madg)
        {
            this.madg = madg;
        }
        public string get_madg()
        {
            return madg;
        }
        public bool taomoi()
        {
            Truyxuatdulieu txdl = new Truyxuatdulieu();
            if (txdl.thucthitruyvan("insert into THE values('" + mathe + "','" + madg + "','" + ngaycap + "','" + ngayhethan +"')") == 1)
            {
                KetNoi.closeconnect();
                return true;
            }

            else
            {
                KetNoi.closeconnect();
                return false;
            }
        }
        public bool xoa()
        {
            Truyxuatdulieu txdl = new Truyxuatdulieu();
            if (txdl.thucthitruyvan("delete from THE where MADOCGIA = '"+ madg +"'") == 1)
            {
                KetNoi.closeconnect();
                return true;
            }

            else
            {
                KetNoi.closeconnect();
                return false;
            }
        }

    }
}
